package com.yiren.dbaa.module.practice_set.map.presenter;

import android.app.Activity;

import com.yiren.backstage.config.api.LoadConfigApi;
import com.yiren.backstage.config.bean.device.UserParamConfigBean;
import com.yiren.backstage.currency.entity.MapEntity;
import com.yiren.dbaa.currency.api.CommonCallBack;
import com.yiren.dbaa.module.practice_set.map.contract.MapHomeContract;
import com.yiren.dbaa.module.practice_set.map.contract.OpenMapContract;
import com.yiren.dbaa.module.practice_set.map.model.MapHomeModel;
import com.yiren.dbaa.module.practice_set.map.model.OpenMapModel;

/**
 * @author lwb
 * @date : 2022/11/28 16:29
 * @description: 已公开地图
 */
public class OpenMapPresenter implements OpenMapContract.Presenter {
    private Activity activity;
    private OpenMapContract.Model openMapModel;
    private MapHomeContract.Model mapHomeModel;

    public OpenMapPresenter(Activity activity) {
        this.activity = activity;
        openMapModel = new OpenMapModel(activity);
        mapHomeModel = new MapHomeModel(activity);
    }

    @Override
    public void loadOpenMap(String siteCode,CommonCallBack callBack) {
        //从服务器获取地图
        UserParamConfigBean userParamConfigBean = LoadConfigApi.loadUserParamConfig(activity);
        mapHomeModel.getMapFromServer(userParamConfigBean.getUserInfo().getId().toString(),true,callBack);
    }

    @Override
    public void setMapState(int state, MapEntity map, CommonCallBack callBack) {
        openMapModel.changeMapState(state,map,callBack);
    }
}
